<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Auto SET/GET in PHP</title>
<!-- Bootstrap core CSS -->
<link href="templates/vbmb/styles/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="templates/vbmb/styles/styles.css" rel="stylesheet">
<style>
.ta{
	display: block;
width: 500px;
margin: auto;
height: 500px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
-webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}
</style>
</head>

<body>
<form class="form-horizontal" role="form" method="POST">
    
    <div class="form-group">
      <label class="col-md-4 control-label">Tên biến</label>
      <div class="col-md-6">
        <input type="text" class="form-control" name="bien" required="required" autofocus="autofocus"/>
      </div>
    </div>
    
    <div class="form-group">
      <label class="col-md-4 control-label">&nbsp;</label>
      <div class="col-md-6">
        <input type="submit" class="btn btn-success" value="OK" name="ok"/>
      </div>
    </div>
  </form>
<br />
<div class="ta"> 
<?php
	if (isset($_POST['bien'])){
		$bien = $_POST['bien'];
		$bien_array = explode(" ",$bien);
		foreach($bien_array as $item){
		echo 'protected $_'.$item.';';
		echo "<br />";
			}
		
		foreach($bien_array as $item){
		echo "<br />";
		echo 'public function set_'.$item.' ($i) {
				$this->_'.$item.' = $i;
			}
			';
		echo "<br />";
		echo          'public function get_'.$item.' () {
				return $this->_'.$item.';	
			}
			';
		echo "<br />";
		}
	}
?>
   </div>
<!-- Placed at the end of the document so the pages load faster --> 
<script src="templates/vbmb/styles/js/jquery.min.js"></script> 
<script src="templates/vbmb/styles/js/bootstrap.min.js"></script> 
<script src="templates/vbmb/styles/js/javascript.js"></script>
</body>
</html>